
<!DOCTYPE HTML>
<html>
<%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<link href="<%=request.getContextPath()%>/css/common/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/common/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/iconfont/iconfont.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/font-awesome/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="<%=request.getContextPath()%>/css/common/style.css" rel="stylesheet" type="text/css" />
<title>修改密码密码</title>
</head>
<body>
	<div class="pd-20">
		<form action="" method="post" class="form form-horizontal" id="form-resetPassword">
			<div class="row cl">
				<label class="form-label col-3"><span class="c-red">*</span>旧密码</label>
				<div class="formControls col-3">
					<input type="password" class="input-text" value="" placeholder="" id="oldPassword" name="oldPassword" datatype="*2-16" errormsg="请输入2到16位的任意字符" nullmsg="此项不能为空">
				</div>
				<label class="col-3"></label>
			</div>
			<div class="row cl">
				<label class="form-label col-3"><span class="c-red">*</span>新密码</label>
				<div class="formControls col-3">
					<input type="password" class="input-text" value="" placeholder="" id="userpassword" name="userpassword" datatype="*2-16" errormsg="请输入2到16位的任意字符" nullmsg="此项不能为空">
				</div>
				<label class="col-3"></label>
			</div>
			<div class="row cl">
				<label class="form-label col-3"><span class="c-red">*</span>确认密码</label>
				<div class="formControls col-3">
					<input type="password" value="" class="input-text" name="userpassword1" recheck="userpassword"  datatype="*2-16" errormsg="您两次输入的账号密码不一致！" nullmsg="此项不能为空">
				</div>
				<label class="col-3"></label>
			</div>
			<div class="row cl">
				<div class="col-9 col-offset-3">
					<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;" >
				</div>
			</div>
		</form>
	</div>
<script type="text/javascript" src="<%=request.getContextPath()%>/lib/common/jquery.min.js"></script> 
<script type="text/javascript" src="<%=request.getContextPath()%>/lib/layer1.8/layer.min.js"></script> 
<script type="text/javascript" src="<%=request.getContextPath()%>/lib/common/Validform_v5.3.2.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/lib/common/H-ui.js"></script> 
<script type="text/javascript" src="<%=request.getContextPath()%>/lib/common/H-ui.admin.js"></script> 
<script type="text/javascript">
$(function() {
	$("#form-resetPassword").Validform({
		tiptype : 2,
		showAllError : true,
		btnSubmit: "bnt_submit",
		datatype : {
			"empty" : /^\s*$/,
			"money" : /^[1-9]\d{0,5}$/
		},
		callback : function(form) {
			bnt_submit();
			return false;
		}
	});
}); 
bnt_submit = function(){
   var data = {};
   data.oldPassword = $.trim($("#oldPassword").val());
   data.userpassword = $.trim($("#userpassword").val());
   if(data.userpassword==''){
	   $.Showmsg("密码不能为空！");
	   return;
   }
   layer.confirm('您确定要提交吗？',function(){
	   $.ajax({
			type : "post",
			url : '<%=request.getContextPath()%>/api/session/changePassword',
			dataType : "json",
			contentType : "application/json",
			data : JSON.stringify(data),
			success : function(result) {
				if (!result.flag) {
					layer.msg("提交失败！原因：" + result.message);
					return;
				}
				parent.location.reload();
				window.close();
			}
		});  
   })
}
</script>
</body>
</html>